package com.jerry.template.module.mainpage.shouye.jinghua.activity;

import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.jerry.template.R;

import butterknife.BindView;
import butterknife.ButterKnife;

public class JinghuaWebViewActivity extends AppCompatActivity {
    //等待进度的对话框
    private ProgressDialog mDialog;
    @BindView(R.id.webView)
    public WebView webview;
    private String webUrl;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_jinghua_web_view);
        // 绑定视图和事件
        ButterKnife.bind(this);
        Intent intent = getIntent();
        webUrl = intent.getStringExtra("webUrl");
        // 加载数据，
        this.loadData();
    }

    private void loadData() {
        webview.getSettings().setLoadWithOverviewMode(true);
        webview.getSettings().setUseWideViewPort(true);
        webview.getSettings().setJavaScriptEnabled(true);
        webview.setWebViewClient(new WebViewClient(){
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url){
                view.loadUrl(url);
                return true;
            }
        });
        webview.loadUrl(webUrl);
    }


}
